// components/changeTeamerModal/changeTeamerModal.js
const defaultData = {
    leaderChange: false,
    modalHide: false,
    lChangeM: 2
};

Component({
    /**
   * 组件的属性列表
   */
    properties: {
        leaderChange: {
            type: Boolean,
            value: false
        },
        modalHide: {
            type: Boolean,
            value: false
        },
        currentLeaderInfo: {
            type: Object,
            // 修正为Object类型
            value: {}
        },
        myleaderinfo: {
            type: Object,
            // 修正为Object类型
            value: {}
        },
        lChange: {
            type: Number,
            value: 0
        },
        leaderNameChange: {
            type: String,
            observer(newVal, oldVal, changePath) {
                this.setData({
                    leaderName: newVal
                });
            }
        },
        communityNameChange: {
            type: String,
            observer(newVal, oldVal, changePath) {
                this.setData({
                    communityName: newVal
                });
            }
        }
    },
    /**
   * 组件的初始数据
   */
    data: {
        ...defaultData,
        leaderName: "团长",
        communityName: "社区"
    },
    /**
   * 组件的方法列表
   */
    methods: {
        chooseButt(e) {
            var myEventDetail = {
                id: e.currentTarget.dataset.leaderid
            };
            var myEventOption = {};
            // 触发事件的选项
                        this.triggerEvent("myevent", myEventDetail, myEventOption);
        },
        // 取消弹窗
        close() {
            this.setData({
                leaderChange: false
            });
        },
        // 提示框确定
        modalConfirm() {
            this.setData({
                modalHide: true
            });
        }
    },
    lifetimes: {
        ready() {
            // 组件初始化完成时触发
        }
    }
});